﻿//code by Heskey0
//https://space.bilibili.com/455965619
//https://github.com/Heskey0

using System;
using Common.DesignPattern;
using Common.Extension;
using UnityEngine;

namespace Teresa
{
    /// <summary>
    /// Mgr : 提供方法
    /// Manager : 消息
    /// </summary>
    public class MonoSingletonMgr : Singleton<MonoSingletonMgr>
    {
        private GameObject _monoSingletonRoot;
        

        public T AddMonoSingleton<T>() where T : Component
        {
            if (_monoSingletonRoot == null)
            {
                _monoSingletonRoot = new GameObject("MonoSingletonRoot").DontDestroyOnLoad();
            }
            return _monoSingletonRoot.AddComponent<T>();
        }
    }
}